using System.Windows;
using System.Windows.Markup;

namespace ProjectView.Windows
{
	public partial class MultiFileSaveWindow : Window, IComponentConnector
	{
		public static readonly DependencyProperty MessageProperty = DependencyProperty.Register("Message", typeof(string), typeof(MultiFileSaveWindow), new PropertyMetadata(null));

		public static readonly DependencyProperty SaveAllProperty = DependencyProperty.Register("SaveAll", typeof(bool), typeof(MultiFileSaveWindow), new PropertyMetadata(false));

		private bool? result;

		public string Message
		{
			get
			{
				return (string)GetValue(MessageProperty);
			}
			set
			{
				SetValue(MessageProperty, value);
			}
		}

		public bool SaveAll
		{
			get
			{
				return (bool)GetValue(SaveAllProperty);
			}
			set
			{
				SetValue(SaveAllProperty, value);
			}
		}

		public MultiFileSaveWindow()
		{
			InitializeComponent();
		}

		public void ShowSaveAll(bool visible)
		{
			cbSaveAll.Visibility = ((!visible) ? Visibility.Hidden : Visibility.Visible);
		}

		public new bool? ShowDialog()
		{
			base.ShowDialog();
			return result;
		}

		private void btnSave_Click(object sender, RoutedEventArgs e)
		{
			result = true;
			Close();
		}

		private void btnNotSave_Click(object sender, RoutedEventArgs e)
		{
			result = false;
			Close();
		}

		private void btnCancel_Click(object sender, RoutedEventArgs e)
		{
			result = null;
			Close();
		}
	}
}
